from time import *
c = 0
f = open("m1_sorted.txt")
m = f.read().split()
m1 = list(map(int, m))
f.close()
t1 = time()
for j in range(4999):
    for i in range(4998, j - 1, -1):
        if m1[i + 1] < m1[i]:
            m1[i + 1], m1[i] = m1[i], m1[i + 1]
            c = 1
    if c == 0:
        break
t2 = time()
print("m1_sorted", int((t2 - t1) * 1000), "milliseconds")
c = 0
f = open("m2_reverse.txt")
m = f.read().split()
m1 = list(map(int, m))
f.close()
t1 = time()
for j in range(4999):
    for i in range(4998, j - 1, -1):
        if m1[i + 1] < m1[i]:
            m1[i + 1], m1[i] = m1[i], m1[i + 1]
            c = 1
    if c == 0:
        break
t2 = time()
print("m2_reverse", int((t2 - t1) * 1000), "milliseconds")
c = 0
f = open("m3_shuffle.txt")
m = f.read().split()
m1 = list(map(int, m))
f.close()
t1 = time()
for j in range(4999):
    for i in range(4998, j - 1, -1):
        if m1[i + 1] < m1[i]:
            m1[i + 1], m1[i] = m1[i], m1[i + 1]
            c = 1
    if c == 0:
        break
t2 = time()
print("m3_shuffle", int((t2 - t1) * 1000), "milliseconds")
